package com.ncr.travel.appmgr.client.event;

import java.util.List;

import com.google.gwt.event.shared.GwtEvent;
import com.ncr.travel.appmgr.client.ConfigurationItem;
import com.ncr.travel.appmgr.model.shared.Function;
import com.ncr.travel.appmgr.model.shared.Graphics;
import com.ncr.travel.appmgr.model.shared.Rule;
import com.ncr.travel.appmgr.model.shared.ScreenConfiguration;
import com.ncr.travel.appmgr.model.shared.Text;

public class ConfirmConfigChangeEvent extends GwtEvent<ConfirmConfigChangeEventHandler> {
	private static Type<ConfirmConfigChangeEventHandler> TYPE = new Type<ConfirmConfigChangeEventHandler>();

	private final ConfigurationItem configurationItem;
	private final List<Function> functions;
	private final List<Graphics> graphics;
	private final List<Rule> rules;
	private final List<Text> text;

	public ConfirmConfigChangeEvent(ConfigurationItem configItem, ScreenConfiguration screenConfiguration) {
		super();
		this.configurationItem = configItem;
		this.functions = screenConfiguration.getFunctions();
		this.graphics = screenConfiguration.getGraphics();
		this.rules = screenConfiguration.getRules();
		this.text = screenConfiguration.getText();
	}

	/**
	 * Gets the event type associated with load events.
	 * 
	 * @return the handler type
	 */
	public static com.google.gwt.event.shared.GwtEvent.Type<ConfirmConfigChangeEventHandler> getType() {
		return TYPE;
	}

	/**
	 * @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
	 */
	@Override
	protected void dispatch(ConfirmConfigChangeEventHandler handler) {
		handler.onConfirm(this);
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<ConfirmConfigChangeEventHandler> getAssociatedType() {
		return TYPE;
	}

	public ConfigurationItem getConfigurationItem() {
		return configurationItem;
	}

	public List<Function> getFunctions() {
		return functions;
	}

	public List<Graphics> getGraphics() {
		return graphics;
	}

	public List<Rule> getRules() {
		return rules;
	}

	public List<Text> getText() {
		return text;
	}

}
